﻿using System;
using System.IO;
using System.Runtime.Serialization;

namespace MyFloridaHouse.libServiceBusinessRules
{
    class Serializer
    {
        public static byte[] Serialize(Object objectToSerialize)
        {
            var objectToSerializeType = objectToSerialize.GetType();
            var mySerializer = new DataContractSerializer(objectToSerializeType);
            var serializeMemoryStream = new MemoryStream();
            mySerializer.WriteObject(serializeMemoryStream, objectToSerialize);
            return serializeMemoryStream.ToArray();
        }
    }
}
